#ifndef ADDAO
#define ADDAO
#define AD_DB_PATH "/home/ly/ly_ads/ads.db"

 typedef struct AdResource
  {
     int id;
     int ad_id;
     int type_id;
     char* path;
     char* sign;
     int index;
  } AdResource;
  
 typedef struct Ad
  {
    //广告本身信息
    int id;
    int template_id;
    int customer_id;
    char* start_time;
    char* end_time;
    int state;
    int index;

    //广告资源
    AdResource *resources[3];
  } Ad;
  

int saveAd(Ad *ad);
int updateAd(Ad *ad);
Ad* getAd(int id);


int saveAr(AdResource *ar);
int updateAr(AdResource *ar);
AdResource* getAr(int adid,int index);

int clearExpireAd();

#endif